<?
	$fpage = 1;
	$lpage = $listnum;

	while($fpage<=$total_page) {
		if(($fpage<=$p) && ($p<=$lpage)) {
			if($lpage>$total_page) { $lpage=$total_page; }
			break;
		}		
		$fpage=$fpage+$listnum;
		$lpage=$lpage+$listnum;
	}

	if($p>$listnum) {
		$pre10page=$fpage-1;
		echo"<a href='$PHP_SELF?$get_val&p=$pre10page'><img src='/image/bt_10prev.gif' hspace='5' align='absmiddle'></a> ";
	}
	if($p == 1) { 
		echo "<img src='/image/bt_prev.gif' hspace='5' align='absmiddle'> "; 
	} else { 
		$prevpage = $p-1; 
		echo "<a href='$PHP_SELF?$get_val&p=$prevpage'><img src='/image/bt_prev.gif' hspace='5' align='absmiddle'></a> ";
	}
	for ($page = $fpage; $page <= $lpage; $page++) {
		if ($page == $p) { 
			echo "<span class='w_text'><font size='3'><b>$page</b></font></span>";
		}	else { 
			echo "<a href='$PHP_SELF?$get_val&p=$page'>$page</a>";
		}
	  echo" ";
	}
	if($p == $total_page) {	
		echo "<img src='/image/bt_next.gif' hspace='5' align='absmiddle'>"; 
	}	else { 
		$nextpage = $p+1; 
		echo"<a href='$PHP_SELF?$get_val&p=$nextpage'><img src='/image/bt_next.gif' hspace='5' align='absmiddle'></a>"; 
	}
	if($lpage<$total_page) {
		$next10page=$lpage+1;
		echo" <a href='$PHP_SELF?$get_val&p=$next10page'><img src='/image/bt_10next.gif' hspace='5' align='absmiddle'></a>";
	}
?>